package com.byxy.ssm.demo.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.byxy.ssm.demo.dao.UserDao;
import com.byxy.ssm.demo.entity.User;
import com.byxy.ssm.demo.service.UserService;
@Service
@Transactional
public class UserServiceImpl implements UserService {

	@Autowired
	private UserDao userDao;
	@Override
	public User getByNameAndPassword(String userName, String userPassword) {
		// TODO Auto-generated method stub
		// 找到 返回对象
		// 找不到 返回 null
		return userDao.getByNameAndPassword(userName,userPassword);
	}
	@Override
	public void save(String user_name, String user_nick, String user_password, Integer user_type) {
		User u = new User();
		u.setUserName(user_name);
		u.setUserNick(user_nick);
		u.setUserType(user_type);
		u.setUserPassword(user_password);
		userDao.save(u);
	}

}
